﻿using FreeSql.DataAnnotations;
using Jumei.Common.BaseModel;
using Jumei.Model.Business.OrdersManage;

namespace Jumei.Model.Business.MemberManage
{
    /// <summary>
    /// 会员积分表
    /// </summary>
	[Table(Name = "mb_member_scores")]
    [Index("idx_{tablename}_01", nameof(SourceType), false)]
    [Index("idx_{tablename}_02", nameof(ScoreSource), false)]
    public class MemberScoresEntity : EntityFull, ITenant
    {
        /// <summary>
        /// 租户Id
        /// </summary>
        [Column(Position = -10)]
        public long? TenantId { get; set; }

        /// <summary>
        /// 会员Id
        /// </summary>
        public long MemberId { get; set; }

        public MemberEntity Member { get; set; }

        /// <summary>
        /// 积分
        /// </summary>
        public int Score { get; set; }

        /// <summary>
        /// 来源
        /// </summary>
        [Column(MapType = typeof(int))]
        public ScoreSourceType ScoreSource { get; set; }

        /// <summary>
        /// 来源记录ID orderId
        /// </summary>
        public long OrderId { get; set; }

        public OrdersEntity Orders { get; set; }

        /// <summary>
        /// 描述
        /// </summary>
        [Column(StringLength = -2)]
        public string Remarks { get; set; }

        /// <summary>
        /// 积分类型  1:收入 2：支出
        /// </summary>
        public int SourceType { get; set; }
    }
}
